package model

import (
	"gorm.io/gorm"
	"time"
)

type CreateModel struct {
	ID        int `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
	CreatedAt int `gorm:"index;comment:创建时间" json:"created_at,omitempty"`
}
type BaseModel struct {
	ID        int `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
	CreatedAt int `gorm:"index;comment:创建时间" json:"created_at,omitempty"`
	UpdatedAt int `gorm:"index;comment:修改时间" json:"updated_at,omitempty"`
}
type DeleteModel struct {
	ID        int `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
	CreatedAt int `gorm:"index;comment:创建时间" json:"created_at,omitempty"`
	UpdatedAt int `gorm:"index;comment:修改时间" json:"updated_at,omitempty"`
	DeletedAt int `gorm:"index;comment:删除时间" json:"-"`
}
type User struct { //用户表
	gorm.Model
	UserName   string     `gorm:"column:user_name;type:varchar(255);comment:用户名称;" json:"userName"`
	Name       string     `gorm:"type:varchar(255);comment:真实姓名;" json:"name"`
	Age        int        `gorm:"comment:用户年龄;" json:"age"`
	Sex        string     `gorm:"type:varchar(255);comment:性别;" json:"sex"`
	UserType   int        `gorm:"type:tinyint(4);comment:用户类型;" json:"userType"`
	Orders     []Order    //Has Many
	CreditCard CreditCard //Has One
}
type Shop struct { //商城表
	DeleteModel
	ShopId string  `gorm:"type:varchar(100);comment:商品ID;" json:"id"`
	Name   string  `gorm:"type:varchar(255);comment:商品名称;" json:"name"`
	Desc   string  `gorm:"type:varchar(255);comment:商品描述;" json:"desc"`
	Price  float32 `gorm:"type:float;comment:价格;" json:"Price"`
}
type Order struct { //订单表
	BaseModel
	UserId   int       `gorm:"column:user_id;type:uint;comment:用户ID;" json:"userId"`
	ShopName string    `gorm:"type:varchar(255);comment:商品名称;" json:"shopName"`
	Num      string    `gorm:"type:int;comment:商品数量;" json:"num"`
	Price    float64   `gorm:"type:int;comment:分类ID;" json:"price"`
	Time     time.Time `gorm:"type:datetime;comment:购买时间;" json:"time"`
}
type CreditCard struct { //信用卡
	BaseModel
	Number string `gorm:"type:varchar(255);comment:商品名称;" json:"number"`
	UserID uint   `gorm:"column:user_id;type:uint;comment:用户ID;" json:"userId"`
}
type AvatarStore struct { //形象仓库表
	gorm.Model
	AvatarId  int     `gorm:"type:int;comment:形象ID;" json:"id"`
	Name      string  `gorm:"type:varchar(255);comment:形象名称;" json:"name"`
	Desc      string  `gorm:"type:varchar(255);comment:形象描述;" json:"desc"`
	Price     float32 `gorm:"type:float;comment:价格;" json:"price"`
	PublishId int     `gorm:"type:int;comment:发布人;" json:"publishId"`
}
type AvatarCategory struct { //形象分类表 二级分类
	CategoryId int              `gorm:"type:int;comment:分类ID;" json:"categoryId"`
	Name       string           `gorm:"type:varchar(255);comment:分类名称;" json:"name"`
	ParentId   float32          `gorm:"type:tinyint(4);comment:父类;" json:"parentId"`
	Children   []AvatarCategory `gorm:"-" json:"children"`
}
type AvatarStoreCategory struct { //关系表
	AvatarId   int `gorm:"type:int;comment:形象ID;" json:"id"`
	CategoryId int `gorm:"type:int;comment:分类ID;" json:"categoryId"`
}

func tttwe() {
}
